#include <bits/stdc++.h>

#define eb emplace_back
#define ep emplace
#define fi first
#define se second
#define in read<int>()
#define lin read<ll>()
#define rep(i, x, y) for(int i = (x); i <= (y); i++)
#define per(i, x, y) for(int i = (x); i >= (y); i--)

using namespace std;

using ll = long long;
using db = double;
using pii = pair < int, int >;
using vec = vector < int >;
using veg = vector < pii >;

template < typename T > T read() {
	T x = 0; bool f = 0; char ch = getchar();
	while(!isdigit(ch)) f |= ch == '-', ch = getchar();
	while(isdigit(ch)) x = x * 10 + (ch ^ 48), ch = getchar();
	return f ? -x : x;
}

template < typename T > void chkmax(T &x, const T &y) { x = x > y ? x : y; }
template < typename T > void chkmin(T &x, const T &y) { x = x < y ? x : y; }

const int N = 5e5 + 10;

int n, m, fa[N], ans[N], top;
bool vis[N], ban[N], fl;
vec G[N];

void pdfs(int x, int p) {
	fa[x] = p; vis[x] = true;
	for(auto y : G[x])
		if(y ^ p) {
			if(!vis[y]) pdfs(y, x);
			else {
				int u = x; fl = true;
				while(u != y) ban[u] = true, u = fa[u];
				ban[u] = true; 
			} if(fl) return;
		}
}

int lst = 1e9;
bool tban = 0;

void dfs(int x) {
	ans[++top] = x; vis[x] = true;
	if(!ban[x]) { for(auto y : G[x]) if(!vis[y]) dfs(y); return; }
	int cho = false;
	rep(i, 0, int(G[x].size()) - 1) {
		if(tban) break;
		int y = G[x][i]; if(cho) break;
		if(vis[y]) continue;
		if(ban[y]) {
			int nxt = 0;
			rep(j, i + 1, int(G[x].size()) - 1) {
				if(vis[G[x][j]]) continue;
				nxt = G[x][j]; break;
			}
			if(nxt == 0) {
				if(y > lst) { cho = true; break; }
			}
			else lst = nxt;
			break;
		}
	} if(cho) tban = true;
	for(auto y : G[x]) {
		if(vis[y]) continue;
		if(ban[y] && cho) continue;
		dfs(y);
	}
}

int main() {
#ifndef ONLINE_JUDGE
	freopen("1.in", "r", stdin);
#endif
	n = in, m = in;
	rep(i, 1, m) {
		int u = in, v = in; G[u].eb(v); G[v].eb(u);
	}
	rep(i, 1, n) sort(G[i].begin(), G[i].end());
	pdfs(1, 0); rep(i, 1, n) vis[i] = 0; dfs(1);
	rep(i, 1, n) printf("%d ", ans[i]);
	return 0;
}
